package com.cwiyc.orderonlineback.controller;

import com.cwiyc.orderonlineback.entity.AliPay;
import com.cwiyc.orderonlineback.service.AliPayServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("alipay")
public class AliPayController {
    @Autowired
    AliPayServiceImpl aliPayService;

    @GetMapping("/pay")
    public String pay(AliPay aliPay) {
        return aliPayService.pay(aliPay);
    }

    @PostMapping("/notify")  // 注意这里必须是POST接口
    public String payNotify(HttpServletRequest request) throws Exception {
        return aliPayService.payNotify(request);
    }
}